<!DOCTYPE html>
@import act.test.Scenario
@import act.test.Interaction
@args List<Scenario> result, boolean failure
<html>
<head>
  <meta charset="utf-8">
  @ifNot(failure) {
  <link rel="icon" type="image/png" href="/~/asset/img/test-success.ico?v=@act.Act.VERSION.getBuildNumber()">
  } else {
  <link rel="icon" type="image/png" href="/~/asset/img/test-failure.ico?v=@act.Act.VERSION.getBuildNumber()">
  }
  <script src="/~/asset/js/jquery.js?v=@act.Act.VERSION.getBuildNumber()"></script>
  <style>
    body {
      background-color: #222;
      color: #f1f1f1;
      font-family: "Noto Sans", Tahoma, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
      font-size: 13px;
    }
    a {color: #00b8b6;}
    h1,h2,h3,h4,h5 {
      font-family: "Franklin Gothic Medium", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif;
    }
    h4 {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 5px;
      margin-top: 30px;
      border-bottom: 1px dotted #888;
      padding-bottom: 8px;
    }
    #act-version {
      position:fixed;
      bottom:0;
      right:0;
      font-size: 11pt;
      padding: 5px 10px;
    }
    .interactions {
      list-style: none;
      padding-left: 0;
      margin-top: 10px;
      padding-bottom: 10px;
    }
    .PASS {
      color: #00ee00;
    }
    .FAIL {
      color: #ee0000;
    }
    .PENDING {
      color: #ccc;
    }
    .error-message {
      margin-left: 2em;
    }
    .version {
      font-weight: 600;
    }
    .open-source {
      display:none;
    }
    h4.ignore {
      color: #aaa;
      text-decoration: line-through;
    }
    ul.interactions li {
      margin-bottom: 8px;
    }
  </style>
  @render(head)
</head>
<body>
<h1>Test Report</h1>
<div class="version">@(_app.name().capFirst())-@(_app.version().getVersion())</div>
@for(Scenario scenario: result) {
<h4 @if(scenario.ignore) {class="ignore"}>
  @scenario.title() @if(scenario.issueUrl) {
    &nbsp;<a class="issue-url" href="@scenario.issueUrl" target="_blank"  title="jump to issue page" style="text-decoration: none">
  <img src="/~/asset/img/@(scenario.issueUrlIcon).png" style="height: 16px; padding-left: 1px;"></img>
     </a>
  }
  @if(!scenario.ignore && !scenario.status.pass()) {
    @if(scenario.source) {
  <ul class="open-source" style="list-style-type:none; padding-left: 0px; font-size: 90%">
    <li style="margin-bottom: 5px">
      &gt;
      <a href="/~/test/@scenario.name.toUpperCase()" target="@scenario.name.toLowerCase()">
        Re-run scenario 
      </a>
    </li>
    <li>
      &gt;
      <a href="http://localhost:8091?message=@(scenario.source):1">Open scenario source</a>
    </li>
  </ul>
  <span class="no-source">
    <a href="/~/test/@scenario.name.toUpperCase()" target="@scenario.name.toLowerCase()">
      Re-run scenario &gt;
    </a>
  </span>
    } else {
  &nbsp;&nbsp;
  <a href="/~/test/@scenario.name.toUpperCase()" target="@scenario.name.toLowerCase()">
    Re-run scenario &gt;
  </a>
    }
  }
</h4>


@if(!scenario.ignore && !scenario.status.pass() && null != scenario.errorMessage && !scenario.errorMessage.contains("Interaction[")) {
<div class="@scenario.status">
  [@scenario.status] @scenario.errorMessage
  @if(null != scenario.cause && (!(scenario.cause instanceof act.test.util.ErrorMessage))) {
  <pre>
@scenario.causeStackTrace()
  </pre>
  }
</div>
}

@ifNot(scenario.ignore) {
<ul class="interactions">
@for (Interaction interaction: scenario.interactions) {
  <li class="@interaction.status">
    [@interaction.status] @interaction.description.capFirst()
    @if(interaction.errorMessage) {
    <div class="error-message">- @interaction.errorMessage</div>
    @if(interaction.cause != null && (!(interaction.cause instanceof act.test.util.ErrorMessage))) {
<pre>
@interaction.causeStackTrace()
</pre>
    }
    }
  </li>
}
</ul>
}

}
<a id="act-version" href="https://github.com/actframework/actframework">actframework-@act.Act.VERSION.getVersion()</a>
<script>
$.ajax({
      url: 'http://localhost:8091/',
      type: 'GET',
      crossDomain: true,
      dataType: 'jsonp',
      timeout: 500,
      success: function (ip) {
        $('.no-source').hide();
        $('.open-source').show();
      },
      error: function (err) {
        if (err.status === 200) {
          $('.no-source').hide();
          $('.open-source').show();
        }
      }
});
</script>
</body>
</html>